package com.heima.user.controller.v1;

import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.user.dtos.AuthDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.user.service.ApUserRealnameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author xjs
 * @date 2022/9/5 11:27
 * description
 */

@RestController
@RequestMapping("/api/v1/auth")
public class ApUserRealnameController {

    @Autowired
    private ApUserRealnameService apUserRealnameService;

    @PostMapping("/list")
    public ResponseResult authList(@RequestBody AuthDto authDto){
        return apUserRealnameService.authList(authDto);
    }

    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDto authDto){
        authDto.setStatus(9);
        apUserRealnameService.authPass(authDto);
        return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);
    };

    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDto authDto){
        authDto.setStatus(2);
        apUserRealnameService.authPass(authDto);
        return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);
    };
}
